package com.jctrip.hotel.source.xxl.hmein;

import com.jctrip.hotel.common.constant.XxlJobNameConstant;
import com.jctrip.hotel.source.service.hmein.HmeinTaskService;
import com.xxl.job.core.context.XxlJobHelper;
import com.xxl.job.core.handler.IJobHandler;
import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * @Author: zxy
 * @CreateTime: 2023-09-04 20:32
 * @Description:
 */
@Component
@Slf4j
public class SyncHmeinLongerRatesPushXxlJob extends IJobHandler {
    @Resource
    private HmeinTaskService hmeinTaskService;

    @Override
    @XxlJob(XxlJobNameConstant.SYNC_HMEIN_LONGER_RATES_TASK_PUSH)
    public void execute() throws Exception {
        XxlJobHelper.log(XxlJobNameConstant.SYNC_HMEIN_LONGER_RATES_TASK_PUSH + " xxl job start");
        try {
            hmeinTaskService.syncHmeinLongerRatesTaskPush();
        } catch (Exception e) {
            log.error(XxlJobNameConstant.SYNC_HMEIN_LONGER_RATES_TASK_PUSH + "error", e);
        }

        XxlJobHelper.log(XxlJobNameConstant.SYNC_HMEIN_LONGER_RATES_TASK_PUSH + " xxl job start");
    }
}
